home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bombjack.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  14KB  |  435 lines

  1. /***************************************************************************
  2.  
  3. Bomb Jack
  4.  
  5. driver by Mirko Buffoni
  6.  
  7. bombjac2 has YOU ARE LUCY instead of LUCKY, so it's probably an older version
  8.  
  9.  
  10. MAIN BOARD:
  11.  
  12. 0000-1fff ROM 0
  13. 2000-3fff ROM 1
  14. 4000-5fff ROM 2
  15. 6000-7fff ROM 3
  16. 8000-83ff RAM 0
  17. 8400-87ff RAM 1
  18. 8800-8bff RAM 2
  19. 8c00-8fff RAM 3
  20. 9000-93ff Video RAM (RAM 4)
  21. 9400-97ff Color RAM (RAM 4)
  22. 9c00-9cff Palette RAM
  23. c000-dfff ROM 4
  24.  
  25. memory mapped ports:
  26. read:
  27. b000      IN0
  28. b001      IN1
  29. b002      IN2
  30. b003      watchdog reset?
  31. b004      DSW1
  32. b005      DSW2
  33.  
  34. write:
  35. 9820-987f sprites
  36. 9a00      ? number of small sprites for video controller
  37. 9e00      background image selector
  38. b000      interrupt enable
  39. b004      flip screen
  40. b800      command to soundboard & trigger NMI on sound board
  41.  
  42.  
  43.  
  44. SOUND BOARD:
  45. 0x0000 0x1fff ROM
  46. 0x2000 0x43ff RAM
  47.  
  48. memory mapped ports:
  49. read:
  50. 0x6000 command from soundboard
  51. write :
  52. none
  53.  
  54. IO ports:
  55. write:
  56. 0x00 AY#1 control
  57. 0x01 AY#1 write
  58. 0x10 AY#2 control
  59. 0x11 AY#2 write
  60. 0x80 AY#3 control
  61. 0x81 AY#3 write
  62.  
  63. interrupts:
  64. NMI triggered by the commands sent by MAIN BOARD (?)
  65. NMI interrupts for music timing
  66.  
  67. ***************************************************************************/
  68.  
  69. #include "driver.h"
  70. #include "vidhrdw/generic.h"
  71.  
  72.  
  73.  
  74. WRITE_HANDLER( bombjack_background_w );
  75. WRITE_HANDLER( bombjack_flipscreen_w );
  76. void bombjack_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  77.  
  78.  
  79.  
  80. static int latch;
  81.  
  82. static void soundlatch_callback(int param)
  83. {
  84.     latch = param;
  85. }
  86.  
  87. WRITE_HANDLER( bombjack_soundlatch_w )
  88. {
  89.     /* make all the CPUs synchronize, and only AFTER that write the new command to the latch */
  90.     timer_set(TIME_NOW,data,soundlatch_callback);
  91. }
  92.  
  93. READ_HANDLER( bombjack_soundlatch_r )
  94. {
  95.     int res;
  96.  
  97.  
  98.     res = latch;
  99.     latch = 0;
  100.     return res;
  101. }
  102.  
  103.  
  104.  
  105. static struct MemoryReadAddress readmem[] =
  106. {
  107.     { 0x0000, 0x7fff, MRA_ROM },
  108.     { 0x8000, 0x97ff, MRA_RAM },    /* including video and color RAM */
  109.     { 0xb000, 0xb000, input_port_0_r },    /* player 1 input */
  110.     { 0xb001, 0xb001, input_port_1_r },    /* player 2 input */
  111.     { 0xb002, 0xb002, input_port_2_r },    /* coin */
  112.     { 0xb003, 0xb003, MRA_NOP },    /* watchdog reset? */
  113.     { 0xb004, 0xb004, input_port_3_r },    /* DSW1 */
  114.     { 0xb005, 0xb005, input_port_4_r },    /* DSW2 */
  115.     { 0xc000, 0xdfff, MRA_ROM },
  116.     { -1 }  /* end of table */
  117. };
  118.  
  119. static struct MemoryWriteAddress writemem[] =
  120. {
  121.     { 0x0000, 0x7fff, MWA_ROM },
  122.     { 0x8000, 0x8fff, MWA_RAM },
  123.     { 0x9000, 0x93ff, videoram_w, &videoram, &videoram_size },
  124.     { 0x9400, 0x97ff, colorram_w, &colorram },
  125.     { 0x9820, 0x987f, MWA_RAM, &spriteram, &spriteram_size },
  126.     { 0x9a00, 0x9a00, MWA_NOP },
  127.     { 0x9c00, 0x9cff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
  128.     { 0x9e00, 0x9e00, bombjack_background_w },
  129.     { 0xb000, 0xb000, interrupt_enable_w },
  130.     { 0xb004, 0xb004, bombjack_flipscreen_w },
  131.     { 0xb800, 0xb800, bombjack_soundlatch_w },
  132.     { 0xc000, 0xdfff, MWA_ROM },
  133.     { -1 }  /* end of table */
  134. };
  135.  
  136. static struct MemoryReadAddress bombjack_sound_readmem[] =
  137. {
  138.     { 0x0000, 0x1fff, MRA_ROM },
  139.     { 0x4000, 0x43ff, MRA_RAM },
  140.     { 0x6000, 0x6000, bombjack_soundlatch_r },
  141.     { -1 }  /* end of table */
  142. };
  143.  
  144. static struct MemoryWriteAddress bombjack_sound_writemem[] =
  145. {
  146.     { 0x0000, 0x1fff, MWA_ROM },
  147.     { 0x4000, 0x43ff, MWA_RAM },
  148.     { -1 }  /* end of table */
  149. };
  150.  
  151.  
  152. static struct IOWritePort bombjack_sound_writeport[] =
  153. {
  154.     { 0x00, 0x00, AY8910_control_port_0_w },
  155.     { 0x01, 0x01, AY8910_write_port_0_w },
  156.     { 0x10, 0x10, AY8910_control_port_1_w },
  157.     { 0x11, 0x11, AY8910_write_port_1_w },
  158.     { 0x80, 0x80, AY8910_control_port_2_w },
  159.     { 0x81, 0x81, AY8910_write_port_2_w },
  160.     { -1 }    /* end of table */
  161. };
  162.  
  163.  
  164. INPUT_PORTS_START( bombjack )
  165.     PORT_START    /* IN0 */
  166.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  167.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  168.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  169.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  170.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  171.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  172.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  173.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  174.  
  175.     PORT_START    /* IN1 */
  176.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  177.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  178.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  179.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  180.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  181.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  182.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  183.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  184.  
  185.     PORT_START    /* IN2 */
  186.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  187.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  188.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  189.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  190.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  191.  
  192.     PORT_START    /* DSW0 */
  193.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
  194.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  195.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  196.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  197.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
  198.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_B ) )
  199.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  200.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  201.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  202.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
  203.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
  204.     PORT_DIPSETTING(    0x30, "2" )
  205.     PORT_DIPSETTING(    0x00, "3" )
  206.     PORT_DIPSETTING(    0x10, "4" )
  207.     PORT_DIPSETTING(    0x20, "5" )
  208.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  209.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  210.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  211.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
  212.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  213.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  214.  
  215.     PORT_START    /* DSW1 */
  216.     PORT_DIPNAME( 0x07, 0x00, "Initial High Score?" )
  217.     PORT_DIPSETTING(    0x00, "10000" )
  218.     PORT_DIPSETTING(    0x01, "100000" )
  219.     PORT_DIPSETTING(    0x02, "30000" )
  220.     PORT_DIPSETTING(    0x03, "50000" )
  221.     PORT_DIPSETTING(    0x04, "100000" )
  222.     PORT_DIPSETTING(    0x05, "50000" )
  223.     PORT_DIPSETTING(    0x06, "100000" )
  224.     PORT_DIPSETTING(    0x07, "50000" )
  225.     PORT_DIPNAME( 0x18, 0x00, "Bird Speed" )
  226.     PORT_DIPSETTING(    0x00, "Easy" )
  227.     PORT_DIPSETTING(    0x08, "Medium" )
  228.     PORT_DIPSETTING(    0x10, "Hard" )
  229.     PORT_DIPSETTING(    0x18, "Hardest" )
  230.     PORT_DIPNAME( 0x60, 0x00, "Enemies Number & Speed" )
  231.     PORT_DIPSETTING(    0x20, "Easy" )
  232.     PORT_DIPSETTING(    0x00, "Medium" )
  233.     PORT_DIPSETTING(    0x40, "Hard" )
  234.     PORT_DIPSETTING(    0x60, "Hardest" )
  235.     PORT_DIPNAME( 0x80, 0x00, "Special Coin" )
  236.     PORT_DIPSETTING(    0x00, "Easy" )
  237.     PORT_DIPSETTING(    0x80, "Hard" )
  238. INPUT_PORTS_END
  239.  
  240.  
  241.  
  242. static struct GfxLayout charlayout1 =
  243. {
  244.     8,8,    /* 8*8 characters */
  245.     512,    /* 512 characters */
  246.     3,    /* 3 bits per pixel */
  247.     { 0, 512*8*8, 2*512*8*8 },    /* the bitplanes are separated */
  248.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  249.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  250.     8*8    /* every char takes 8 consecutive bytes */
  251. };
  252.  
  253. static struct GfxLayout charlayout2 =
  254. {
  255.     16,16,    /* 16*16 characters */
  256.     256,    /* 256 characters */
  257.     3,    /* 3 bits per pixel */
  258.     { 0, 1024*8*8, 2*1024*8*8 },    /* the bitplanes are separated */
  259.     { 0, 1, 2, 3, 4, 5, 6, 7,    /* pretty straightforward layout */
  260.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  261.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  262.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  263.     32*8    /* every character takes 32 consecutive bytes */
  264. };
  265.  
  266. static struct GfxLayout spritelayout1 =
  267. {
  268.     16,16,    /* 16*16 sprites */
  269.     128,    /* 128 sprites */
  270.     3,    /* 3 bits per pixel */
  271.     { 0, 1024*8*8, 2*1024*8*8 },    /* the bitplanes are separated */
  272.     { 0, 1, 2, 3, 4, 5, 6, 7,
  273.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  274.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  275.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  276.     32*8    /* every sprite takes 32 consecutive bytes */
  277. };
  278.  
  279. static struct GfxLayout spritelayout2 =
  280. {
  281.     32,32,    /* 32*32 sprites */
  282.     32,    /* 32 sprites */
  283.     3,    /* 3 bits per pixel */
  284.     { 0, 1024*8*8, 2*1024*8*8 },    /* the bitplanes are separated */
  285.     { 0, 1, 2, 3, 4, 5, 6, 7,
  286.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
  287.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
  288.             40*8+0, 40*8+1, 40*8+2, 40*8+3, 40*8+4, 40*8+5, 40*8+6, 40*8+7 },
  289.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  290.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
  291.             64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
  292.             80*8, 81*8, 82*8, 83*8, 84*8, 85*8, 86*8, 87*8 },
  293.     128*8    /* every sprite takes 128 consecutive bytes */
  294. };
  295.  
  296. static struct GfxDecodeInfo gfxdecodeinfo[] =
  297. {
  298.     { REGION_GFX1, 0x0000, &charlayout1,      0, 16 },    /* characters */
  299.     { REGION_GFX2, 0x0000, &charlayout2,      0, 16 },    /* background tiles */
  300.     { REGION_GFX3, 0x0000, &spritelayout1,    0, 16 },    /* normal sprites */
  301.     { REGION_GFX3, 0x1000, &spritelayout2,    0, 16 },    /* large sprites */
  302.     { -1 } /* end of array */
  303. };
  304.  
  305.  
  306.  
  307. static struct AY8910interface ay8910_interface =
  308. {
  309.     3,    /* 3 chips */
  310.     1500000,    /* 1.5 MHz?????? */
  311.     { 13, 13, 13 },
  312.     { 0 },
  313.     { 0 },
  314.     { 0 },
  315.     { 0 }
  316. };
  317.  
  318.  
  319.  
  320. static struct MachineDriver machine_driver_bombjack =
  321. {
  322.     /* basic machine hardware */
  323.     {
  324.         {
  325.             CPU_Z80,
  326.             4000000,    /* 4 Mhz */
  327.             readmem,writemem,0,0,
  328.             nmi_interrupt,1
  329.         },
  330.         {
  331.             CPU_Z80 | CPU_AUDIO_CPU,
  332.             3072000,    /* 3.072 Mhz????? */
  333.             bombjack_sound_readmem,bombjack_sound_writemem,0,bombjack_sound_writeport,
  334.             nmi_interrupt,1
  335.         }
  336.     },
  337.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  338.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  339.     0,
  340.  
  341.     /* video hardware */
  342.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  343.     gfxdecodeinfo,
  344.     128, 128,
  345.     0,
  346.  
  347.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  348.     0,
  349.     generic_vh_start,
  350.     generic_vh_stop,
  351.     bombjack_vh_screenrefresh,
  352.  
  353.     /* sound hardware */
  354.     0,0,0,0,
  355.     {
  356.         {
  357.             SOUND_AY8910,
  358.             &ay8910_interface
  359.         }
  360.     }
  361. };
  362.  
  363.  
  364.  
  365. /***************************************************************************
  366.  
  367.   Game driver(s)
  368.  
  369. ***************************************************************************/
  370.  
  371. ROM_START( bombjack )
  372.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  373.     ROM_LOAD( "09_j01b.bin",  0x0000, 0x2000, 0xc668dc30 )
  374.     ROM_LOAD( "10_l01b.bin",  0x2000, 0x2000, 0x52a1e5fb )
  375.     ROM_LOAD( "11_m01b.bin",  0x4000, 0x2000, 0xb68a062a )
  376.     ROM_LOAD( "12_n01b.bin",  0x6000, 0x2000, 0x1d3ecee5 )
  377.     ROM_LOAD( "13.1r",        0xc000, 0x2000, 0x70e0244d )
  378.  
  379.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound board */
  380.     ROM_LOAD( "01_h03t.bin",  0x0000, 0x2000, 0x8407917d )
  381.  
  382.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  383.     ROM_LOAD( "03_e08t.bin",  0x0000, 0x1000, 0x9f0470d5 )    /* chars */
  384.     ROM_LOAD( "04_h08t.bin",  0x1000, 0x1000, 0x81ec12e6 )
  385.     ROM_LOAD( "05_k08t.bin",  0x2000, 0x1000, 0xe87ec8b1 )
  386.  
  387.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  388.     ROM_LOAD( "06_l08t.bin",  0x0000, 0x2000, 0x51eebd89 )    /* background tiles */
  389.     ROM_LOAD( "07_n08t.bin",  0x2000, 0x2000, 0x9dd98e9d )
  390.     ROM_LOAD( "08_r08t.bin",  0x4000, 0x2000, 0x3155ee7d )
  391.  
  392.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  393.     ROM_LOAD( "16_m07b.bin",  0x0000, 0x2000, 0x94694097 )    /* sprites */
  394.     ROM_LOAD( "15_l07b.bin",  0x2000, 0x2000, 0x013f58f2 )
  395.     ROM_LOAD( "14_j07b.bin",  0x4000, 0x2000, 0x101c858d )
  396.  
  397.     ROM_REGION( 0x1000, REGION_GFX4 )    /* background tilemaps */
  398.     ROM_LOAD( "02_p04t.bin",  0x0000, 0x1000, 0x398d4a02 )
  399. ROM_END
  400.  
  401. ROM_START( bombjac2 )
  402.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  403.     ROM_LOAD( "09_j01b.bin",  0x0000, 0x2000, 0xc668dc30 )
  404.     ROM_LOAD( "10_l01b.bin",  0x2000, 0x2000, 0x52a1e5fb )
  405.     ROM_LOAD( "11_m01b.bin",  0x4000, 0x2000, 0xb68a062a )
  406.     ROM_LOAD( "12_n01b.bin",  0x6000, 0x2000, 0x1d3ecee5 )
  407.     ROM_LOAD( "13_r01b.bin",  0xc000, 0x2000, 0xbcafdd29 )
  408.  
  409.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for sound board */
  410.     ROM_LOAD( "01_h03t.bin",  0x0000, 0x2000, 0x8407917d )
  411.  
  412.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  413.     ROM_LOAD( "03_e08t.bin",  0x0000, 0x1000, 0x9f0470d5 )    /* chars */
  414.     ROM_LOAD( "04_h08t.bin",  0x1000, 0x1000, 0x81ec12e6 )
  415.     ROM_LOAD( "05_k08t.bin",  0x2000, 0x1000, 0xe87ec8b1 )
  416.  
  417.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  418.     ROM_LOAD( "06_l08t.bin",  0x0000, 0x2000, 0x51eebd89 )    /* background tiles */
  419.     ROM_LOAD( "07_n08t.bin",  0x2000, 0x2000, 0x9dd98e9d )
  420.     ROM_LOAD( "08_r08t.bin",  0x4000, 0x2000, 0x3155ee7d )
  421.  
  422.     ROM_REGION( 0x6000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  423.     ROM_LOAD( "16_m07b.bin",  0x0000, 0x2000, 0x94694097 )    /* sprites */
  424.     ROM_LOAD( "15_l07b.bin",  0x2000, 0x2000, 0x013f58f2 )
  425.     ROM_LOAD( "14_j07b.bin",  0x4000, 0x2000, 0x101c858d )
  426.  
  427.     ROM_REGION( 0x1000, REGION_GFX4 )    /* background tilemaps */
  428.     ROM_LOAD( "02_p04t.bin",  0x0000, 0x1000, 0x398d4a02 )
  429. ROM_END
  430.  
  431.  
  432.  
  433. GAME( 1984, bombjack, 0,        bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 1)" )
  434. GAME( 1984, bombjac2, bombjack, bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 2)" )
  435.